<template>
	<view class="enterprise-msg-search-detail">
		<titleName :name="name" :backShow="true"></titleName>
		<view class="content">
			<view class="title">{{item.title}}</view>
			<view class="standard">{{item.subtitle}}</view>
			<view class="msg">
				{{item.content}}
			</view>
		</view>
		<view class="pdf-wrap">
			<image :src="resourceUrl+'pdf.png'" mode=""></image>
			<view class="pdf-detail">
				<view class="name">{{item.attachname}}</view>
				<view class="size">{{item.attachsize}}</view>
			</view>
			<button @click="searchPdf(item.attachurl)">查看</button>
		</view>

	</view>
</template>

<script setup>
	import titleName from '../../components/titleName.vue'
	import http from '../../request/index.js'
	import {
		resourceUrl
	} from '../../request/config'
	import {
		onLoad
	} from '@dcloudio/uni-app'
	import {
		ref
	} from 'vue'
	let status = ref(true)
	let dataList = ref([])
	let name = "详情"
	let item = ref({})


	onLoad((e) => {
		item.value = JSON.parse(e.msg)
		console.log(item.value);
	})
	let searchPdf = (url) => {
		uni.downloadFile({
			url,
			success: function(res) {
				var filePath = res.tempFilePath;
				uni.openDocument({
					filePath: filePath,
					showMenu: true,
					success: function(res) {
						console.log('打开文档成功');
					}
				});
			}
		});


	}
</script>

<style lang="scss" scoped>
	.enterprise-msg-search-detail {
		width: 100vw;
		height: 100vh;
		overflow: hidden;
		background: #F2F2F4;

		.content {
			background-color: #fff;
			padding: 45upx 45upx 57upx 40upx;

			.title {

				font-family: Source Han Sans CN;
				font-weight: 500;
				font-size: 35rpx;
				color: #000000;

			}

			.standard {

				font-family: Source Han Sans CN;
				font-weight: 400;
				font-size: 31rpx;
				color: #070707;
				margin-top: 30upx;
				margin-bottom: 40upx;

			}

			.msg {

				font-family: Source Han Sans CN;
				font-weight: 400;
				font-size: 29rpx;
				color: #072446;
				line-height: 47rpx;

			}
		}

		.pdf-wrap {
			margin-top: 12upx;

			display: flex;
			align-items: center;
			width: 100vw;
			height: 192rpx;
			background: #FFFFFF;
			padding: 0upx 30upx 0 32upx;


			image {
				width: 83rpx;
				height: 92rpx;
				flex-shrink: 0;
			}

			.pdf-detail {
				display: flex;
				flex-direction: column;
				margin-left: 24upx;

				.name {
					width: 443rpx;
					font-family: Source Han Sans CN;
					font-weight: 400;
					font-size: 32rpx;
					color: #292B2C;
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
					flex-grow: 1;

				}

				.size {

					font-family: Source Han Sans CN;
					font-weight: 400;
					font-size: 22rpx;
					color: #A5A9A7;
					margin-top: 8upx;

				}
			}

			button {
				width: 92rpx;
				height: 58rpx;
				background: #FFFFFF;
				border-radius: 29rpx;
				border: 1px solid #0874FA;

				font-family: Source Han Sans CN;
				font-weight: 400;
				font-size: 28rpx;
				color: #0874FA;
				line-height: 58rpx;
				flex-shrink: 0;
				margin-left: 40upx;
			}
		}





	}
</style>